home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / MPW Goodies⁄DTS / MountServer < prev    next >
Text File  |  2022-08-05  |  1KB  |  54 lines

  1. #    MountServer - mount a server
  2. #
  3. #    Usage:    MountServer server
  4. #
  5. #    Status:    MountServer may return the following status values:
  6. #
  7. #            0        the server was mounted
  8. #            1        error
  9. #            4        the user canceled
  10. #
  11. #    MountServer mounts a a server volume.
  12. #    If the volume is not already mounted,
  13. #    it asks for a password for the volume.
  14. #
  15. #    © Apple Computer, Inc. 1988
  16. #    All rights reserved.
  17.  
  18. Set Exit 0
  19. Begin
  20.     Set Server "{1}"
  21.  
  22.     # make sure that names are formed properly
  23.  
  24.     If "{Server}" =~ /([¬:]*)®1:([¬:]+)®2:«0,1»/
  25.         Set Zone "*"
  26.         Set Server "{®1}"
  27.         Set Volume "{®2}"
  28.     Else If "{Server}" =~ /([¬:]*)®1:([¬:]+)®2:([¬:]+)®3:«0,1»/
  29.         Set Zone "{®1}"
  30.         Set Server "{®2}"
  31.         Set Volume "{®3}"
  32.     Else
  33.         Exit 1
  34.     End
  35.  
  36.     # check if the volume is mounted
  37.  
  38.     If `Exists "{Volume}:"` == ""
  39.         # handle case where one volume from this server is already mounted (or empty password)
  40.         Choose "{Zone}:{Server}:{Volume}" ≥ Dev:Null
  41.         If {Status} ≠ 0
  42.             Set IgnoreCmdPeriod 1
  43.             Set Password "`CoolRequest -h -p "Enter your password on the “{Server}” server, please:"; Set GetPasswordStatus {Status}`"
  44.             Set IgnoreCmdPeriod 0
  45.             Exit 4 If {GetPasswordStatus} == 4
  46.             Exit 1 If {GetPasswordStatus} ≠ 0
  47.     
  48.             Choose "{Zone}:{Server}:{Volume}" -pw "{Password}"
  49.             Unset Password
  50.             Exit 1 If {Status} ≠ 0
  51.         End
  52.     End
  53. End ∑ Dev:Null
  54.